//
//  AcitvityLikeCell.m
//  TourPlay
//
//  Created by dllo on 15/11/24.
//  Copyright © 2015年 王军岐. All rights reserved.
//

#import "AcitvityLikeCell.h"
#define WIDTH 8
#define HEIGHT 6

@interface AcitvityLikeCell ()

@property (nonatomic, retain) UIView *viewBack;;
@property (nonatomic, retain) UILabel *likeL;
@end


@implementation AcitvityLikeCell
- (void)dealloc
{
    [_viewBack release];
    [_likeL release];
    [super dealloc];
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
}
- (void)createSubViews
{
    self.viewBack = [[UIView alloc] initWithFrame:CGRectMake(WIDTH, 0, SCREEN_WIDTH - WIDTH * 2, 50)];
    //    self.viewBack.backgroundColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.9f];
    self.viewBack.backgroundColor = [UIColor whiteColor];
    self.viewBack.layer.cornerRadius = 4.f;
    [self.contentView addSubview:self.viewBack];
    [_viewBack release];
    UILabel *titleL = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.viewBack.frame.size.width, 50)];
    //    titleL.backgroundColor = [UIColor orangeColor];
    titleL.text = @"感兴趣的人";
    titleL.textAlignment = NSTextAlignmentCenter;
    titleL.font = [UIFont systemFontOfSize:16.f];
    titleL.textColor = [UIColor colorWithRed:0.71 green:0.68 blue:0.69 alpha:1];
    [self.viewBack addSubview:titleL];
    [titleL release];
    
    UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(self.viewBack.frame.size.width - 12 - 10, self.viewBack.frame.size.height / 2.f - 6, 6, 12)];
    imageV.image = [UIImage imageNamed:@"find_calendar_switching_right_notclickable@3x.png"];
    //    imageV.backgroundColor = [UIColor orangeColor];
    [self.viewBack addSubview:imageV];
    [imageV release];
    
    self.likeL = [[UILabel alloc] initWithFrame:CGRectMake(imageV.frame.origin.x - 60 - 6, 0, 60, titleL.frame.size.height)];
    self.likeL.backgroundColor = [UIColor clearColor];
    self.likeL.font = [UIFont systemFontOfSize:13.5f];
    self.likeL.textColor = titleL.textColor;
    self.likeL.textAlignment = NSTextAlignmentRight;
    [self.viewBack addSubview:self.likeL];
    [_likeL release];
    
    // 夜间模式
    [self addColorChangedBlock:^{
        
        self.viewBack.nightBackgroundColor = [ColorSingleton shareSingleton].cellColor;
        self.viewBack.normalBackgroundColor = [ColorSingleton shareSingleton].cellColor;
    
        
    }];
    
}
- (void)setActivityMod:(ActivityModel *)activityMod
{
    if (_activityMod != activityMod) {
        [_activityMod release];
        _activityMod = [activityMod retain];
    }
    
    self.likeL.text = [NSString stringWithFormat:@"%ld", self.activityMod.likercount];
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
